{ Summer Informatics School.
  Problemset: http://agul-problems1.googlecode.com/svn/trunk/2010-2011/sis/problemset11.pdf
  Problem E
  Points: 100
}
var i,n,s:longint; p:array[0..60] of longint;
procedure swap(var a,b:longint);
var t:longint;
begin
t:=a;
a:=b;
b:=t;
end;
procedure sort(l,r:longint);
var i,j,x:longint;
begin
i:=l;
j:=r;
x:=p[(l+r) shr 1];
repeat
  while p[i]>x do inc(i);
  while p[j]<x do dec(j);
  if i<=j then begin
    swap(p[j],p[i]);
    inc(i);
    dec(j);
  end;
until i>j;
if l<j then sort(l,j);
if i<r then sort(i,r);
end;
begin
fillchar(p,sizeof(p),0);
read(n);
s:=0;
for i:=1 to n do begin
  read(p[i]);
  inc(s,p[i]);
end;
sort(1,n);
i:=1;
while (p[i]>=s-p[i]) and (i<=n) do begin
  dec(s,p[i]);
  inc(i);
end;
if n-i>=2 then write(i-1) else write(-1);
end.
